import Vue from 'vue'
import  * as apis from '../../services/apis'
import * as types from '../mutation-types'
import http from '../../http'

const state = {
  hot_keys: [],
}

const getters ={
  hot_keys: state => state.hot_keys
}

const actions ={
  getHotKeys ({commit}) {
    Vue.http.post(apis.GET_HOT_SEARCH).then((res) => {
     commit(types.GET_HOT_KEYS, res.body)
   })
  }
}


const mutations ={
  [types.GET_HOT_KEYS](state,payload){
    state.hot_keys = payload.result
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
